import {
	defineConfig
} from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import AutoImport from "unplugin-auto-import/vite";
// https://vitejs.dev/config/
const path = require("path");

//编译到各渠道配置
import './bulid'

export default defineConfig({
	plugins: [
		uni(),
		AutoImport({
			imports: ["vue", "uni-app"],
		}),
	],
	resolve: {
		// 配置路径别名
		alias: {
			"@": path.resolve(__dirname, "./src"),
		},
	},
	server: {
		host: "127.0.0.1", // 开发服务器的地址
		port: 5173, // 开发服务器的端口号
		proxy: {
			'/app': {
				target: 'http://alibook.baitaonet.com', //目标源，目标服务器，真实请求地址
				changeOrigin: true, //支持跨域
				rewrite: (path) => path.replace(/^\/app/, "/app"), //重写真实路径,替换/api
			}
		}
	}
});